package com.jerry.base.dynamicproxy;

import java.lang.reflect.Proxy;

/**
 * 用户代理测试
 *
 * @author Jerry
 * @since 2024/7/17 15:45
 */
public class UserServiceTest {

    public static void main(String[] args) throws InterruptedException {
        UserService userService = new UserServiceImpl();
        UserServiceHandler userServiceHandler = new UserServiceHandler(userService);

        UserService proxyService = (UserService) Proxy.newProxyInstance(
                userService.getClass().getClassLoader(),
                userService.getClass().getInterfaces(),
                userServiceHandler);

        proxyService.login();
        proxyService.userInfo();
        proxyService.updateUser();
    }
}
